#!/usr/bin/php
<?php
/**
 * DolphinGTK - phpGtk framework
 *
 * @package    DolphinGTK
 * @author     Askarov Ruslan
 * @copyright  Askarov Ruslan (c) 2010.
 * @link       http://groups.google.com/group/dolphingtk
 * @license    http://www.opensource.org/licenses/gpl-license.php GPL
 * @version    0.1
 * @since      PHP v.: 5.2.1
 * @subpackage desktop
 * @category   main
 * @filesource
 */

define('BASE_DIR', rtrim(str_replace('\\', '/', dirname(__FILE__)), '/'). '/');
include BASE_DIR . 'library/functions.php';

load('widgets');
load('window');
load('tray');
load('os');

Win::close_if_copy();
Win::close_terms(true);
Win::create();

if( Win::$os == 'linux' )
{
  $user = OS::exec('whoami');

  if( $user != 'root' ) {
    Win::alert(
      'Security', i18n('Are you root? Use sudo or gksu prefix.')
    );
    exit;
  }
}

Win::title('DolphinGTK / PPPoE');
Win::icon('images/pppoe.png');
Win::load('pppoe');
Win::load('copyright');
Win::statusbar( i18n('Ready ...') );
Win::show(true);
Win::on_quit('if_quit');

Tray::create();
Tray::tooltips('DolphinGTK / PPPoE');
Tray::icon( 'images/pppoe.png' );
Tray::activate( true );


Win::main();


function if_quit()
{
  $conf = Win::confirm(
    WIN_TITLE, i18n('Are you sure?')
  );

  if( $conf === true ) {
    Win::quit();
    return false;
  }

  return true;
}
?>